TOPDIR = ../..

include $(TOPDIR)/Makefile.common

SRCS = $(wildcard *.cc)
OBJS = $(SRCS:.cc=.o)

ifeq ($(strip $(ODEHOME)),)
$(error Need to set the ODEHOME environment variable!)
endif

IDFLAGS  += -I $(INCDIR)/sim -I $(ODEHOME)/include
LDFLAGS  += -L $(ODEHOME)/lib

ifneq ($(shell ls /usr/include/GL | grep glu.h), )
LIBS = -lode -ldrawstuff -lGL -lGLU -lpthread -lutils
else
LIBS = -lode -lpthread -lutils
endif

TARGET  = ubersim
#DEPENDS = Makefile.dep

####

all :: $(TARGET)

$(TARGET): $(OBJS)
	echo $(LDFLAGS)
	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
	ln -f -s ../src/sim/$(TARGET) $(BINDIR)/$(TARGET)

#dep: $(DEPENDS)

#$(DEPENDS):
#	$(CC) -M $(CFLAGS) $(INC) $(SRCS) > $(DEPENDS)

#include $(DEPENDS)
